package com.blueseaapps.utility;

import java.util.UUID;

import android.content.Context;

public class UserDataManager {
	private static UUID uniqueId;
	
	public static UUID getUniqueId(Context cxt){
		if(uniqueId == null){
			String uidString = SharedPreferenceManager.getPreferenceValue(cxt, SharedPreferenceManager.PREF_KEY_UNIQUE_ID);
			if(uidString != null){
				uniqueId = UUID.fromString(uidString.trim());
			}else{
				uniqueId = UUID.randomUUID();
				setUniqueId(cxt, uniqueId);
			}
		}
		return uniqueId;
	}
	
	public static boolean setUniqueId(Context cxt, UUID uuid){
		return SharedPreferenceManager.setPreferenceValue(cxt, SharedPreferenceManager.PREF_KEY_UNIQUE_ID, uuid.toString());
	}
	
	public static String getRegistrationId(Context cxt){
		return SharedPreferenceManager.getPreferenceValue(cxt, SharedPreferenceManager.PREF_KEY_REGISTRATION_ID);
	}
	
	public static boolean setRegistrationId(Context cxt, String regId){
		return SharedPreferenceManager.setPreferenceValue(cxt, SharedPreferenceManager.PREF_KEY_REGISTRATION_ID, regId);
	}

}
